﻿/**************************************************************
 * Project     : Titan Framework
 * Copyright (C) 2011 Microsoft Corp.
 * Author      : Julian Hu
 * Mail        : junhu@microsoft.com
 * Create Date : 2011-05-10
 * Summary     :   
 * 
 * 
 * Modified By : 
 * Date        : 
 * Mail        : 
 * Comment     :   
 * *************************************************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace Titan.Logging
{
    /// <summary>
    /// 日志的基类
    /// </summary>
    public abstract class Logger : DisposableObject, ILogger
    {
        #region Properties
        public Type Type { get; private set; }
        public abstract bool IsDebugEnabled { get; }
        public abstract bool IsInfoEnabled { get; }
        public abstract bool IsWarnEnabled { get; }
        public abstract bool IsErrorEnabled { get; }
        public abstract bool IsFatalEnabled { get; }
        #endregion

        #region Constructors
        protected Logger(Type type)
        {
            //如果对象为空,则抛出异常.
            if (ReferenceEquals(type, null))
                throw new ArgumentNullException(type.FullName);

            Type = type;
        }
        #endregion

        #region Public Methods
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public abstract void Debug(string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="msg"></param>
        public abstract void Debug(Exception exception, string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public abstract void Info(string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="msg"></param>
        public abstract void Info(Exception exception, string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public abstract void Warn(string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="msg"></param>
        public abstract void Warn(Exception exception, string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public abstract void Error(string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="msg"></param>
        public abstract void Error(Exception exception, string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="msg"></param>
        public abstract void Fatal(string msg);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="exception"></param>
        /// <param name="msg"></param>
        public abstract void Fatal(Exception exception, string msg);
        #endregion
    }
}
